<?php

namespace app\api\model;

use think\Model;
use app\api\model\DeviceDevice as Device;
/**
 * DeviceEngine
 */
class DevicePlace extends Model
{
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = true;

    /**
     * 追加属性
     */
    protected $append = [
        'lat_lng',
   
    ];
    public function getLatLngAttr($value, $data){
        if($data['location']){
            return explode(',',$data['location']);
        }
        return [];
    }
    public function devices(): \think\model\relation\HasMany
    {
        return $this->hasMany(Device::class,'id','place_id');
    }

}